﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="BG.Web.Desktop.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title> 
    <link href="resources/Kwan.Desktop.css" rel="stylesheet" type="text/css" />
    <link rel="Stylesheet" href="resources/Kwan.icon.css" />
</head>
<body>
    <script src="Kwan.Base.js" type="text/javascript"></script>
    <script src="resources/Kwan.Desktop.js" type="text/javascript"></script>
    <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="Desktop">
            <Listeners>
                <DocumentReady Handler="Kwan.alignPanels();" />
                <WindowResize Handler="Kwan.alignPanels();" />
            </Listeners>
        </ext:ResourceManager>

        <ext:Store ID="Store1" runat="server" OnRefreshData="RefreshDS" RemoteSort="True">
            <Proxy>
                <ext:PageProxy />
            </Proxy>
            <Reader>
                <ext:JsonReader IDProperty="EntityID">
                    <Fields>
                        <ext:RecordField Name="EntityID" />
						<ext:RecordField Name="CheckInDate" />
                        <ext:RecordField Name="CheckInRoomPrice" />
						<ext:RecordField Name="CheckInType" />
						<ext:RecordField Name="Days" />
						<ext:RecordField Name="Deposit" />
						<ext:RecordField Name="RoomID" />
						<ext:RecordField Name="Status" />
                        <ext:RecordField Name="RoomClassName" />
                        <ext:RecordField Name="RoomNO" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <AutoLoadParams>
                <ext:Parameter Name="start" Value="0" Mode="Raw" />
                <ext:Parameter Name="limit" Value="50" Mode="Raw"/>
            </AutoLoadParams>
            <SortInfo Field="EntityID" Direction="DESC" />
            <Listeners> 
                <LoadException Handler="Ext.MessageBox.alert('系统提示', response.statusText);" />                            
            </Listeners>
        </ext:Store>
        <ext:Desktop ID="MyDesktop" runat="server" BackgroundColor="Black" ShortcutTextColor="White" Wallpaper="resources/images/desktop.jpg" EnableViewState="False">
            <Content>
                <ext:Panel ID="pnlSample" runat="server" Title="已入住房间" Cls="desktopEl" Height="400" Width="500"  Collapsible="true" Layout="Fit">
                    <Items>
        <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" ColumnLines="True" AutoExpandColumn="RoomNO" Header="False" Frame="true" TrackMouseOver="true" StripeRows="true">
            <ColumnModel ID="ColumnModel1" runat="server">
			    <Columns>
                    <ext:RowNumbererColumn />
                    <ext:Column Header="房间号" DataIndex="RoomNO" Width="80" />
                    <ext:Column Header="房型" DataIndex="RoomClassName" Width="70" />
					<ext:Column Header="预住天数" DataIndex="Days" Width="60" />
                    <ext:Column Header="入住单价" DataIndex="CheckInRoomPrice" Width="60" />
					<ext:Column Header="已交押金" DataIndex="Deposit" Width="60" />
					<ext:Column Header="入住时间" DataIndex="CheckInDate" Width="130">
                        <Renderer Fn="Kwan.fmDT" />
                    </ext:Column>
			    </Columns>
            </ColumnModel>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolBar1" runat="server" PageSize="50" />
            </BottomBar>
        </ext:GridPanel>
                    </Items>
                </ext:Panel>
                <%--密码窗体--%>
                <ext:Window ID="winPassword" runat="server" Icon="Group" Title="修改密码" Width="400" Height="200" AutoShow="false" Modal="true" Collapsible="true" Hidden="true" Layout="Fit" LabelWidth="70" AnimateTarget="btnEditPassword">
                    <Items>
                        <ext:FormPanel ID="fpPassword" MonitorValid="true" runat="server" Header="false" Icon="ChartOrganisation" Padding="5" Layout="Form" LabelAlign="Right" LabelWidth="70" MonitorResize="true">
                            <Items>
                                <ext:Hidden ID="txtUserID" runat="server" />
                                <ext:TextField ID="txtUserName" ReadOnly="true" FieldLabel="用户名" AnchorHorizontal="90%" runat="server" AllowBlank="false" />
                                <ext:TextField ID="txtOldPassword" runat="server" InputType="Password" FieldLabel="旧密码" MinLength="6" AnchorHorizontal="90%" AllowBlank="false" />
                                <ext:TextField ID="txtNewPassword" InputType="Password" FieldLabel="新密码" MinLength="6" AnchorHorizontal="90%" runat="server" AllowBlank="false" />
                                <ext:TextField ID="txtVPassword" InputType="Password" Vtype="password" MsgTarget="Side" FieldLabel="确认新密码" MinLength="6" AnchorHorizontal="90%" AllowBlank="false" runat="server" VtypeText="与新密码不一致">
                                <CustomConfig>
                                    <ext:ConfigItem Name="initialPassField" Value="#{txtNewPassword}" Mode="Value" />
                                </CustomConfig>
                                </ext:TextField>
                            </Items>
                            <Buttons>
                                <ext:Button ID="SaveButton" runat="server" Icon="Disk" Text="确认">
                                    <DirectEvents>
                                        <Click OnEvent="SavePasswordWindow" Failure="Ext.MessageBox.alert('系统提示', response.statusText);">
                                            <EventMask Target="CustomTarget" CustomTarget="={#{winPassword}.body}" ShowMask="True" />
                                        </Click>
                                    </DirectEvents>
                                </ext:Button>
                                <ext:Button ID="CancelButton" runat="server" Text="返回" Icon="Cancel">
                                    <Listeners>
                                        <Click Handler="#{winPassword}.hide();" />
                                    </Listeners>
                                </ext:Button>
                            </Buttons>
                        </ext:FormPanel>
                    </Items>
                </ext:Window>
            </Content>
            <StartButton Text="开始" IconCls="start-button"/>
            <%-- NOTE: Body Controls must be added to a container with position:absolute --%>
            <%-- 开始菜单里的东西 --%>
            <Modules>
                <%--<ext:DesktopModule>
                    <Launcher OnClientClick="createDynamicWindow(#{MyDesktop},'开始菜单里的-我的电脑','http://www.baidu.com')" Text="我的电脑" Icon="Add" />
                </ext:DesktopModule>
                
                <ext:DesktopModule>
                    <Launcher OnClientClick="createDynamicWindow(#{MyDesktop},'开始菜单里的-网上邻居','http://www.baidu.com')" Text="网上邻居" Icon="Lorry" />
                </ext:DesktopModule>
                
                <ext:DesktopModule>
                    <Launcher OnClientClick="createDynamicWindow(#{MyDesktop},'开始菜单里的-IE浏览器','http://www.baidu.com')" Text="IE浏览器" Icon="World" />
                </ext:DesktopModule>--%>
            </Modules>  
            <%-- END开始菜单里的东西 --%>

            <Listeners>
                <ShortcutClick Handler="Kwan.shortstart(#{MyDesktop},id);" />
            </Listeners>

            <StartMenu Width="300" Height="400" ToolsWidth="127" Title="艺苑宾馆管理系统">
                <ToolItems>
                    <ext:MenuItem ID="miEditPassword" Text="修改密码" Icon="Wrench">
                        <Listeners>
                            <Click Handler="Desktop.EditPassword()" />
                        </Listeners>
                    </ext:MenuItem>
                    <ext:MenuItem Text="注销" Icon="Disconnect">
                        <DirectEvents>
                            <Click OnEvent="Logout_Click">
                                <EventMask ShowMask="true" Msg="正在注销用户..." />
                            </Click>
                        </DirectEvents>
                    </ext:MenuItem>
                    <ext:MenuSeparator />
                    <%-- 开始菜单右侧 --%>
                </ToolItems>
                
            </StartMenu>
        </ext:Desktop>
        <%--刷新入住信息--%>
        <ext:TaskManager ID="TaskManager1" runat="server" AutoRunDelay="5000">
            <Tasks>
                <ext:Task TaskID="RefreshRoomStatus" Interval="5000">
                    <Listeners>
                        <Update Handler="Store1.reload();" />
                    </Listeners>    
                </ext:Task>
            </Tasks>
        </ext:TaskManager>
    </form>
</body>
</html>


